<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTableCrowds extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('crowds', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('shop_id')->nullable();
            $table->string('no')->unique();
            $table->integer('user_id')->index();
            $table->string('cover');
            $table->string('title');
            $table->integer('link_id');
            $table->jsonb('detail')->nullable();
            $table->integer('number');
            $table->integer('price');
            $table->integer('support_money');
            $table->integer('self_pay');
            $table->dateTime('last_support_time')->nullable();
            $table->string('status');
            $table->integer('referrer_id')->nullable()->index();
            $table->integer('rebate')->default(0);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('crowds');
    }
}
